package com.kyin.satoken.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

/**
 * @author yin.kai
 * @ClassName RequestLoggingConfig
 * @description: 请求打印日志配置类
 * @date 2025/9/24 9:14
 * @version: 1.0
 */
//@Configuration
public class RequestLoggingConfig {
//    @Bean
    public CommonsRequestLoggingFilter logFilter() {
        CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
        filter.setIncludeQueryString(true); // 包含查询参数
        filter.setIncludePayload(true);  // 包含请求体
        filter.setMaxPayloadLength(10000); // 限制请求体日志长度（避免大字段溢出）
        filter.setIncludeHeaders(false);
        filter.setAfterMessagePrefix("【请求信息:】");
        return filter;
    }
}
